package liurong.driver.room;

import java.io.File;

import org.junit.experimental.theories.Theories;

public class CreateRoomNo {
	private static final int MAX_ROOM_ID = 99999999;

	private static final int MIX_ROOM_ID = 11111311;

	private static final int MAX_INDEX = 1234567;

	public static int getLoginRoomID(int index) {
		int iMaxNumberSection = MAX_ROOM_ID - MIX_ROOM_ID;
		int iStep = (int) iMaxNumberSection / MAX_INDEX;
		int rand = (int) (Math.random() * iStep);
		return (MIX_ROOM_ID + MAX_INDEX * rand + index);
	}
	
	public void fun1() {
		
		System.out.println(CreateRoomNo.class.getClassLoader().getResource(""));
		System.out.println(CreateRoomNo.class.getClassLoader().getResource("/"));
//		File file = new File(this.getClass().getClassLoader().getResource(File.separator).getPath());
//		System.out.println(file);
//		System.out.println(file.isDirectory());
//		
//		file = new File(this.getClass().getClassLoader().getResource("").getPath());
//		System.out.println(file);
//		System.out.println(file.isDirectory());
	}

	public static void main(String[] args) {
		
		CreateRoomNo createRoomNo = new CreateRoomNo();
		createRoomNo.fun1();


		System.out.println(Math.random());
		System.out.println((MIX_ROOM_ID + (MAX_INDEX * 70)));
		System.out.println("---------------");
		System.out.println(MAX_ROOM_ID - (MIX_ROOM_ID + (MAX_INDEX * 70)));
		System.out.println(2104621);
		System.out.println("---------------");
		System.out.println(MIX_ROOM_ID + MAX_INDEX * 70 + 2877891);
		System.out.println("---留给我们的数及时间----");
		System.out.println(2468998 - 315281);
		System.out.println((2468998 - 315281) / 20000);
		System.out.println((2468998 - 315281) / 1500);
		System.out.println((2468998 - 315281) / 1500 / 30);
		System.out.println((2468998 - 315281) / 1500 / 30 / 12);

		// int count = 0;
		// for (int i = 0; i < 1000000; i++) {
		// int loginRoomID = getLoginRoomID(2468999);
		// if (loginRoomID > 99999999) {
		// System.out.println(loginRoomID);
		// count++;
		// }
		// }
		// System.out.println(count);
	}
}
